import java.util.Arrays;
import java.util.Scanner;

public class test {
    public static void my_sort(int[] arr1){
        int left = 0;
        int right = arr1.length - 1;
        int mid = -1;
        while(left < right){
            if(arr1[left] % 2 ==0 && arr1[right] % 2 != 0){
                mid = arr1[left];
                arr1[left] = arr1[right];
                arr1[right] = mid;
                left++;
                right--;
            }
            if(arr1[left] % 2 != 0){
                left++;
            }
            if(arr1[right] % 2 == 0){
                right--;
            }
        }
    }
    public static void main(String[] args) {

//        调整数组顺序使得奇数位于偶数之前。调整之后，不关心大小顺序。
//
//        如数组：[1,2,3,4,5,6]
//
//        调整后可能是：[1, 5, 3, 4, 2, 6]
        Scanner scan = new Scanner(System.in);
        int[] arr1 = {1,2,3,4,5,6,7,8,9,10};
        //int n = scan.nextInt();
        my_sort(arr1);
        System.out.println(Arrays.toString(arr1));
    }
}
